import { GuildCopyEntrancePanelBase } from "./GuildCopyEntrancePanelBase";
import { ObjCreate } from "../../../common/ObjCreate";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { FontUtil } from "../../../../../common/font/FontUtil";
import { GlobalStyle } from "../../../../../common/global/GlobalStyle";
import { GSprite } from "../../../../../../com/mui/controls/GSprite";
import { CopyConfig } from "../../../../resource/CopyConfig";
import { GScrollPane } from "../../../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../../../fl/controls/ScrollPolicy";
import { Language } from "../../../../../../extend/language/Language";
import { Cache } from "../../../../cache/Cache";
import { MsgManager } from "../../../../manager/MsgManager";
import { Dispatcher } from "../../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../../events/DataEvent";
import { EventName } from "../../../../mvc/EventName";
import { GLabel } from "../../../../../../com/mui/controls/GLabel";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
import { GButton } from "../../../../../../com/mui/controls/GButton";
//class GuildEliteCopyEntrancePanel
    
    export  class GuildEliteCopyEntrancePanel extends GuildCopyEntrancePanelBase
    {
        constructor()
        {
            super();
            ObjCreate.createLoadedBitmap("text_fengshentai.png", 23, 66, this);
            this._numLabel = ObjCreate.createLabel("", 110, 68, 120, 20, flash.text.TextFormatAlign.LEFT, this, true, 16776960);
            var loc1=new GTextFormat(FontUtil.songtiName, 12, GlobalStyle.color1Uint, null, null, null, null, null, null, null, null, null, 3);
            var loc2=new GSprite();
            this._descText = ObjCreate.createGTextField("", 0, 0, 290, 230, loc2, loc1);
            this._descText.wordWrap = true;
            this._descText.multiline = true;
            this._descText.mouseWheelEnabled = false;
            this._descText.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._descText.htmlText = CopyConfig.instance.getGuildCopyDesc(9);
            var loc3=new GScrollPane();
            loc3.x = 28;
            loc3.y = 100;
            loc3.width = 300;
            loc3.height = 245;
            loc3.styleName = "GScrollPane";
            loc3.verticalScrollPolicy = ScrollPolicy.AUTO;
            loc3.horizontalScrollPolicy = ScrollPolicy.OFF;
            loc3.source = loc2;
            loc3.scrollDrag = false;
            loc3.setScrollBarSize(19);
            addChild(loc3);
            loc3.update();
            this._lookUp = ObjCreate.createGButton(Language.getString(60638), 60, 355, 72, 26, this);
            this._lookUp.addEventListener(flash.events.MouseEvent.CLICK, this.onLookUpButtonClickHandler);
            this._optBtn = ObjCreate.createGButton(Language.getString(60407), 140, 355, 72, 26, this);
            this._optBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onOptButtonClick);
            this._guildWarehouseEx = ObjCreate.createGButton(Language.getString(90319), 220, 355, 72, 26, this);
            this._guildWarehouseEx.addEventListener(flash.events.MouseEvent.CLICK, this.onGuildWarehouseExHandler);
            return;
        }

        /* internal  */onOptButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (Cache.instance.guildElite.inTime || Cache.instance.guildElite.inPreTime) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60470));
            }
            else 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GuildElite_DoOpenGuildEliteCopy));
            }
            return;
        }

        /* internal  */onLookUpButtonClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildElite_ShowGuildEliteModule));
            return;
        }

        public /* override */ updateStatus(): void
        {
            if (Cache.instance.guildElite.isTodayOpened) 
            {
                this._numLabel.htmlText = "（" + Language.getString(60640) + "）";
            }
            else 
            {
                this._numLabel.htmlText = "（" + Language.getString(60639) + "）";
            }
            return;
        }

        /* internal  */onGuildWarehouseExHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildWarehouseExOpen));
            return;
        }

        /* internal */ /* var */_numLabel: GLabel;

        /* internal */ /* var */_descText: GTextFiled;

        /* internal */ /* var */_lookUp: GButton;

        /* internal */ /* var */_optBtn: GButton;

        /* internal */ /* var */_guildWarehouseEx: GButton;
    }
